from Common.Base import Base


class Baidu(Base):
    def login_button(self):
        return self.get_element(locator=('xpath', '/html/body/div[1]/div[1]/div[4]/a'))

    def new_button(self):
        return self.get_element(locator=('xpath', '/html/body/div[1]/div[1]/div[3]/a[1]'))

    def hao123_button(self):
        return self.get_element(locator=('xpath', '//*[@id="s-top-left"]/a[2]'))

    def map_button(self):
        return self.get_element(locator=('xpath', '/html/body/div[1]/div[1]/div[3]/a[3]'))

    def input_box(self):
        return self.get_element(locator=('xpath', '//*[@id="kw"]'))

    def search_button(self):
        return self.get_element(locator=('xpath', '/html/body/div[1]/div[1]/div[5]/div/div/form/span[2]/input'))

    def search_message(self, message):
        element1 = self.input_box()
        self.send_keys(element1, keywords=message)
        element2 = self.search_button()
        self.click_element(element2)
        return True
